<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/view/common/easycommon.jsp" %>
<!DOCTYPE html>
<html>
<head>
  <title>任务流转</title>
  <meta charset="utf-8">
  <style>
    table {
      font-size: 14px
    }
    a{
      text-decoration:none;
    }

  </style>
  <script>
    $(function () {
      var datagrid; //定义全局变量datagrid
      var editRow = undefined; //定义全局变量：当前编辑的行
      datagrid = $('#dataTable').treegrid({
        //rownumbers: true,
        //singleSelect:true,
        //pagination: true,
        //pageSize: 30,
        //singleSelect:false,
        fit: true, //datagrid自适应宽度
        fitColumn: false, //列自适应宽度
        //striped: true, //行背景交换
        //nowap: true, //列内容多时自动折至第二行
        //border: false,
        treeField: 'toUserName',
        idField: 'taskUserId', //主键
        url: "${path}/cootask/queryTransDetail?id=${id}",
        columns: [[
          {field: 'toUserName', title: '接收人', width: 200},
          {field: 'fromUserName', title: '流转人', width: 100},
          {field: 'createdtimeYMD', title: '流转时间', width: 100},
          //{field: 'content', title: '任务内容', width: 250},
          {field: 'taskTypeName', title: '任务类型', width: 80},
          {field: 'taskLevelName', title: '任务等级', width: 80},
          {field: 'beginTime', title: '开始时间', width: 100},
          {field: 'endTime', title: '结束时间', width: 100},
          {field: 'transferMaxLevel', title: '最大流转次数', width: 100},
          {field: 'transferLevel', title: '当前流转次数', width: 100},
          //{field: 'note', title: '备注', width: 250},
          {field: 'statusName', title: '流转状态', width: 80},
          {field: 'transNote', title: '流转备注', width: 250},
          {field: '_operate', title: '操作', width:50, formatter: formatOper}
        ]],
        //queryParams: { action: 'query' }, //查询参数
        toolbar: [
          {
            text: '查询', iconCls: 'icon-search', handler: function () {
              searchFun();
            }
          }]
      });
    })

    function formatOper(val, row, index) {
      return '<a href="#" onclick="tablePop(' + index + ')">查看</a>   ';
    }

    //查询
    function searchFun(){
      var options = $('#dataTable').treegrid('options');
      //options.url = '${path}/report/khfxGridData';
      //options.queryParams = { dateYear: $('#querydate').val()};
      $('#dataTable').treegrid(options);
    }

    var layIndex;
    //查看扩展信息
    function tablePop(index){
      //$('#dataTable').treegrid('selectRow', index);
      var row = $('#dataTable').treegrid('getSelected');
      console.log(row);
      if (row.id&&row.taskUserId) {
        var url = "${path}/cootasktable/show?fTaskHeadid="+row.id+"&fTaskUserid="+row.taskUserId;
        url = decodeURI(url);
        layIndex = layer.open({
          title:"扩展信息",
          type: 2,
          fix: false,
          maxmin: true,
          area: ['880px', '670px'],
          content: url,
          cancel: function(index){

          }
        });
      } else {
        $.messager.alert("提示", "请先选择一条记录", "error");
      }
    }
  </script>
</head>
<body>
<table id="dataTable" title="任务流转" class="easyui-treegrid" style="width:850px;height:450px"
        iconCls="icon-save">
</table>
</body>
</html>
